package com.latam.arq.example.persistence.services;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.latam.arq.commons.persistence.ibatis.IBatisPersistenceServices;
import com.latam.arq.example.domain.AdmisionBean;
import com.latam.arq.example.domain.PacienteBean;
import com.latam.arq.example.domain.PamBean;
import com.latam.arq.example.persistence.exceptions.ExampleBeanServiceException;

/**

 */
public class AdmisionBeanServices extends IBatisPersistenceServices<AdmisionBeanMapper> implements AdmisionBeanMapper  {
	
	
	private static final Logger logger = LoggerFactory.getLogger(AdmisionBeanServices.class);
	
	
	public void save(AdmisionBean admision) throws ExampleBeanServiceException {
		try {
			
			mapper.insert(admision);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			throw new ExampleBeanServiceException(e);
		}
	}
	
	public List<AdmisionBean> list() throws ExampleBeanServiceException{
		
		try {
			
			return 	mapper.list();
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			throw new ExampleBeanServiceException(e);
		}
		
	}
	
	public List<AdmisionBean> get() throws ExampleBeanServiceException{
	
	try {
		
		return 	mapper.list();
	} catch (Exception e) {
		logger.error(e.getMessage(), e);
		throw new ExampleBeanServiceException(e);
	}
	
}

	@Override
	public void insert(AdmisionBean admision)
			throws ExampleBeanServiceException {
		 	mapper.insert(admision);
		
	}

	@Override
	public List<AdmisionBean> getByRol(String rol) throws ExampleBeanServiceException{
		
		return 	mapper.getByRol(rol);
	
	}
	
	
	@Override
	public void update(AdmisionBean admision)	throws ExampleBeanServiceException {
		 	mapper.update(admision);
		
	}
	
	

	
}
